package cn.joeg.app.web.db.user;


import cn.joeg.app.css.util.DBHelper;
import cn.joeg.app.web.db.util.DBInput;
import cn.joeg.app.web.db.util.DBInvoker;
import cn.joeg.app.web.db.util.DBOutput;
import cn.joeg.app.web.db.util.DBUtil;
import com.ecfront.dew.common.JsonHelper;
import com.ecfront.dew.common.Resp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.util.List;


@Service
public class UserFightService extends DBHelper implements DBInvoker<UserFightService.Input, UserFightService.Output> {

    @Autowired
    private DBUtil dbUtil;

    @Override
    public Resp<Output> execute(Input input) {
        return null;
    }


    public static class Input extends DBInput {
    }

    public static class Output extends DBOutput {
    }


    /**
     * 得到一战到底玩家数据
     *
     * @return
     */
    public UserFighterVO queryUserFighterByUserid(int userId) {
        List resList = dbUtil.psQuery("select * from starwork_fight where hostid = ?", new Object[]{userId});
        if (resList.size() > 0) {
            List<UserFighterVO> userFighterVOList = JsonHelper.toList(resList, UserFighterVO.class);
            return userFighterVOList.get(0);
        }
        return null;
    }


    public static class UserFighterVO {


        private int hostid;             //
        private int cLevel;             //
        private String cName;           //
        private int fCapacity;          //'九大属性加装备附加属性',
        private String myFighters;      //'镜像',
        private String formation;       //
        private String killPlayerId;    //'已战胜的玩家ID',
        private int curHp;              //'0',
        private Timestamp resetTime;    //'当前时间跟这个时间不在同一天就更新，同时更新重置次数',
        private int resetNum;           //'1',
        private int stage;              //'1',
        private int hasBox;             //'1未打，0已打',
        private String enemyInfo;       //
        private String enemyFighters;   //
        private int enemyCurHp;         //'0',
        private String deadCards;       //
        private int hNum;               //'0',

        public int getHostid() {
            return hostid;
        }

        public void setHostid(int hostid) {
            this.hostid = hostid;
        }

        public int getcLevel() {
            return cLevel;
        }

        public void setcLevel(int cLevel) {
            this.cLevel = cLevel;
        }

        public String getcName() {
            return cName;
        }

        public void setcName(String cName) {
            this.cName = cName;
        }

        public int getfCapacity() {
            return fCapacity;
        }

        public void setfCapacity(int fCapacity) {
            this.fCapacity = fCapacity;
        }

        public String getMyFighters() {
            return myFighters;
        }

        public void setMyFighters(String myFighters) {
            this.myFighters = myFighters;
        }

        public String getFormation() {
            return formation;
        }

        public void setFormation(String formation) {
            this.formation = formation;
        }

        public String getKillPlayerId() {
            return killPlayerId;
        }

        public void setKillPlayerId(String killPlayerId) {
            this.killPlayerId = killPlayerId;
        }

        public int getCurHp() {
            return curHp;
        }

        public void setCurHp(int curHp) {
            this.curHp = curHp;
        }

        public Timestamp getResetTime() {
            return resetTime;
        }

        public void setResetTime(Timestamp resetTime) {
            this.resetTime = resetTime;
        }

        public int getResetNum() {
            return resetNum;
        }

        public void setResetNum(int resetNum) {
            this.resetNum = resetNum;
        }

        public int getStage() {
            return stage;
        }

        public void setStage(int stage) {
            this.stage = stage;
        }

        public int getHasBox() {
            return hasBox;
        }

        public void setHasBox(int hasBox) {
            this.hasBox = hasBox;
        }

        public String getEnemyInfo() {
            return enemyInfo;
        }

        public void setEnemyInfo(String enemyInfo) {
            this.enemyInfo = enemyInfo;
        }

        public String getEnemyFighters() {
            return enemyFighters;
        }

        public void setEnemyFighters(String enemyFighters) {
            this.enemyFighters = enemyFighters;
        }

        public int getEnemyCurHp() {
            return enemyCurHp;
        }

        public void setEnemyCurHp(int enemyCurHp) {
            this.enemyCurHp = enemyCurHp;
        }

        public String getDeadCards() {
            return deadCards;
        }

        public void setDeadCards(String deadCards) {
            this.deadCards = deadCards;
        }

        public int gethNum() {
            return hNum;
        }

        public void sethNum(int hNum) {
            this.hNum = hNum;
        }
    }


}
